<template>
  <swiper ref="mySwiper" :options="swiperOptions">
    <swiper-slide>
      <img class="swiper-img" src="~assets/avatars/zhizunbao.jpg" alt="">
    </swiper-slide>
    <swiper-slide>
      <img class="swiper-img" src="~assets/avatars/diyuhuo.jpg" alt="">
    </swiper-slide>
    <swiper-slide>
      <img class="swiper-img" src="~assets/avatars/libai.jpg" alt="">
    </swiper-slide>
    <swiper-slide>
      <img class="swiper-img" src="~assets/avatars/meihouwang.jpg" alt="">
    </swiper-slide>
    <div class="swiper-pagination pagination-home" slot="pagination"></div>
  </swiper>
</template>

<script>
  export default {
    name: 'Carousel',
    data() {
      return {
        swiperOptions: {
          pagination: {
            el: '.pagination-home'
          },
        }
      }
    },
    computed: {
      swiper() {
        return this.$refs.mySwiper.$swiper
      }
    },
    mounted() {
      // console.log('Current Swiper instance object', this.swiper)；
      this.swiper.slideTo(3, 1000, false)
    }
  }
</script>

<style lang="scss">
  .swiper-img {
    width: 100%;
    height: 200px;
  }
  .pagination-home {
    text-align: right; 
    .swiper-pagination-bullet {
    background: #fff;
      &.swiper-pagination-bullet-active {
        background: #fff;
      }
    }
  }
</style>